<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
use app\common\widgets\MyDetailView;

/* @var $this yii\web\View */
/* @var $model app\models\Project */

$this->title = $model->projectname;
$this->params['breadcrumbs'][] = ['label' => '项目', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="project-view">
    <div class="bg-info" style="width: 100%;height: 80px;border:1px solid #ddd;border-radius: 3px;">
        <p class="text-primary"style=" color: #0066cc;font-size: 20px;margin-left: 10px;">项目一览</p>
        <div style="float: right;">
        <?= Html::a('更新', ['update', 'id' => $model->id], ['class' => 'btn btn-info','style' => 'margin-right:5px']) ?>
            <?= Html::a('新建', ['create'], ['class' => 'btn btn-info','style' => 'margin-right:5px']) ?>
         <?= Html::a('返回', ['index'], ['class' => 'btn btn-info','style' => 'margin-right:10px']) ?>
        </div>
    </div>
    <?= MyDetailView::widget([
        'model' => $model,
        'attributes' => [
            //'id',
            'projectno',
            'projectname',
            'userid',
            'chargeman',
            'unit',
            'projectfrom',
            'zhxtype',
            'projectlevel',
            'projectplantype',
            'discipline',
            'status',
            'projectmember',
            'isfinish',
            'updatetime',
            'addman',
            'addmanid',
            'addtime',
            'jf_dxjf',
            'jf_zzjf',
            'jf_jhnhx',
            'jf_jhwhx',
            'jf_sbgzf',
            'jf_zcjf',
            'jf_ppf',
            'jf_zcjfhj',
            'jf_syjf',
            'member',
            'projectmoney',
            'mark',
        ],
    ]) ?>
    
    <?php if ($model->upfiles != null) {
                ?>
                <div class="form-group">
                    <label class="col-lg-2 control-label"><h4>已有文档</h4></label>
                    <ul class="list-unstyled project-files col-lg-12">
                        <?php
                        foreach ($model->upfiles as $document) {
                            ?>
                        <li class="col-lg-2"  style="float:left">
                                <div class="media">
                                    <div class="media-left">
                                        <a href="<?= $document->path ?>">
                                            <?php
                                                $path = $document->path;
                                                $filetyep = strtolower(substr($path, strrpos($path, '.') + 1)) ;
                                                
                                                 if ($filetyep == "xls" || $filetyep == "xlsx") {
                                                     ?>
                                             <img class="media-object" src="img/excel.png" alt="..." style="width:50px;height:50px;">
                                            <?php
                                                     
                                                 }else if($filetyep == "doc" || $filetyep == "docx"){
                                                     
                                                     ?>
                                              <img class="media-object" src="img/word.jpg" alt="..." style="width:50px;height:50px;">
                                            <?php
                                                     
                                                 }else if($filetyep == "ppt" || $filetyep == "pptx"){
                                                     ?>
                                            <img class="media-object" src="img/ppt.png" alt="..." style="width:50px;height:50px;">
                                            <?php
                                                     
                                                 }else if($filetyep == "txt"){
                                                     ?>
                                               <img class="media-object" src="img/text.png" alt="..." style="width:50px;height:50px;">
                                            <?php
                                                 }else if($filetyep == "png" || $filetyep == "jpg" || $filetyep == "jpeg" ||$filetyep == "bmp"||$filetyep == "gif"){ 
                                                     ?>
                                               <!--<img class="media-object" src="img/zhaopian.png" alt="..." style="width:50px;height:50px;">-->
                                               <img class="media-object" src="<?= $path ?>" alt="..." style="width:50px;height:50px;">
                                                     <?php
                                                 }
                                                 else{ ?>
                                            <img class="media-object" src="img/file.png" alt="..." style="width:50px;height:50px;">
                                            <?php
                                                     
                                                 }
                                                
                                            ?>
                                           
                                        </a>
                                    </div>
                                </div>
                            <a href="<?= $path ?>"><?= $document->filename ?></a>
                            </li>

                            <?php
                            }
                            ?>
                    </ul>
                 
                </div>

            <?php }
            ?>
    
</div>
